﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using Snowdreamist.Runtime;

namespace Snowdreamist.ComponentModel.MEF
{
    [MetadataAttribute]
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
    public class PluginExportAttribute : ExportAttribute, IPluginMetadata
    {
        public PluginExportAttribute(string id, Type contractType) : this(id, null, contractType) { }

        public PluginExportAttribute(string id, string contractName) : this(id, contractName, null) { }

        public PluginExportAttribute(string id, string contractName, Type contractType)
            : base(contractName, contractType)
        {
            if (id == null)
                throw new ArgumentNullException("id");
            this.ID = id;
        }

        public string ID { get; private set; }

        public string Name { get; set; }

        public string Description { get; set; }

        public string Author { get; set; }

        public string Version { get; set; }

        public string Website { get; set; }
    }
}